# 1+2+3
s = 1+2+3
print('s=%d'%s)

'''
循环
    -for
        如果循环次数已知，用for循环
    -while
        一般用于循环次数未知
'''

'''for'''
# 1+2+3+4+5+6...+100

s = 0
for i in [1,2,3,4,5,6,7,8,9,10]:
    s = s+i

print('s=%d'%s)


classmates = ('白越','陈广德','陈佳奇','仇颖','冯嘉威')
for name in classmates:
    print('name=%s'%name)

# range()
data = range(0,1000)
print(list(data))


s = 0
for i in range(0,101):
    s = s+i
print('s=%d'%s)


'''while'''

s = 0
i = 0
while i <=100:
    s = s+i
    i = i+2
print('s=%d'%s)

# 求100以内的偶数的和
s = 0
for i in range(0,101):
    if i%2==0:
        s = s + i
print('s=%d'%s)

s = 0
i = 0
while s<1000:
    i = i +1
    s = s +i
print('s=%d,i=%d'%(s,i))

'''break'''
s = 0
for i in range(100):
    s = s + i
    if s >1000:
        break   #终止循环
print('s=%d,i=%d'%(s,i))

'''continue'''
s = 0
for i in range(101):
    if i%2==1:
        continue    # 终止本次循环
    s = s + i
print('s=%d'%(s))


# 死循环
s = 0
i = 0
while True:
    s = s+i
    i = i+1
    print(s)
